/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelVerHistoriaClinicaPac.java
 *
 * Created on 23/03/2012, 04:39:11 AM
 */
package com.torresquintero.oncologos.common.vista;

import com.torresquintero.oncologos.entidades.DetalleHistoriaClinica;
import com.torresquintero.oncologos.entidades.HistoriaClinica;
import java.text.DateFormat;
import java.util.List;

/**
 *
 * @author Camilo Andres
 */
public class PanelVerHistoriaClinicaPac extends javax.swing.JPanel {

    
    private HistoriaClinica historia;
    /** Creates new form PanelVerHistoriaClinicaPac */
    public PanelVerHistoriaClinicaPac() {
        initComponents();
        
        
    }

    public void setHistoria(HistoriaClinica historia) {
        this.historia = historia;
         List<DetalleHistoriaClinica> detHis = historia.getDetalleHistoriaClinica();
        
        String texto="";
        for (DetalleHistoriaClinica detalleHistoriaClinica : detHis) {
            texto+="<center><h2><b>"
                    + DateFormat.getDateInstance(DateFormat.FULL).
                    format(detalleHistoriaClinica.getConsulta().getFechaHora())
                    + "</b></h2></center>\n";
            texto+=
                    "<h3><b>Medico</b>:"+detalleHistoriaClinica.getConsulta().getMedico().getNombre()+" "+
                    "<b>Especialidad:</b>"+detalleHistoriaClinica.getConsulta().
                                          getMedico().getEspecialidad().getNombre()+"<br></h3>";
                    
            
            texto+=detalleHistoriaClinica.getComentario();
            
        }
        tpHistoria.setText(texto);
        
    }
    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        tpHistoria = new javax.swing.JTextPane();
        jLabel1 = new javax.swing.JLabel();
        lPaciente = new javax.swing.JLabel();

        tpHistoria.setContentType("text/html");
        tpHistoria.setEditable(false);
        jScrollPane1.setViewportView(tpHistoria);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setText("Historia clinica");

        lPaciente.setFont(new java.awt.Font("Tahoma", 3, 24)); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 657, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lPaciente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap(219, Short.MAX_VALUE)
                        .addComponent(lPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(14, 14, 14))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lPaciente;
    private javax.swing.JTextPane tpHistoria;
    // End of variables declaration//GEN-END:variables
}
